package com.spddr.pmos.rpt.impl;

import java.util.List;
import java.util.stream.Collectors;

import org.joda.time.Minutes;
import org.joda.time.Period;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.spddr.pmos.rpt.RptPlantOnGridEnergy;
import com.spddr.pmos.rpt.pojo.CellValue;

import cn.seqdata.echarts.Option;
import cn.seqdata.tags.Point;
import cn.seqdata.tags.common.IdTags;

@Service
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class RptPlantOnGrIdEnergyImpl extends AbstractPivotChartImpl implements RptPlantOnGridEnergy {

	protected Period intervalOfStorage() {
		return Minutes.minutes(15).toPeriod();
	}

	@Override
	public List<CellValue> loadPivot() {
		return sim(15).getValue().getValues().stream()
				.map(v -> new CellValue(new Point<>(null, new IdTags(id)), v, null, null)).collect(Collectors.toList());
	}

	@Override
	public Option chart() {
		// TODO 直接调用上网计划
		return null;
	}

}
